<?php
session_start();
require_once 'header.php';
function __autoload($className)
	{
    	require_once('class/' . $className . '.class.php');
	}
session::need_member();
if(!empty($_POST))
{
	$Email=$_POST["friendemail"];
	$UserId=session::getuserid();
	$Code=user::GeneralInvite();
	$Insert=database::Insert('checkregis', array('bath' => $Code,'userinvite' => $UserId,'username' => '0'));
	$Check=verify::check($Email);
	echo "This is your invite code <font class=classmenu >$Code </font>, coppy it to your friend, and we have send an email about this invite code to <font class=classmenu > $Email </font>"; 
	if($Check==0)
	{
		$email = "active@freshcvv.cc"; //senders e-mail adress
		$mail_body = "This is your invite code from http://freshcvv.cc: $Code,Plz use it for active your account at http://freshcvv.cc"; //mail bod
		$subject = "Active code from http://freshcvv.cc"; //subject
		$header = "From: $email "; //optional headerfields
		mail($Email, $subject, $mail_body, $header); //mail command :)	
	}
	else 
	{
		echo "Can Not Send Mail, Plz Check your email enter again";
	}
	
}
else 
{
	require_once 'html/sendinvitecode.php';
}


?>